home *** CD-ROM | disk | FTP | other *** search
-
- {
- if(true)
- {
- CWindow_PostScore = §§newclass(CWindow_PostScore,CWindow);
- }
- }
-
- package Local.Draw
- {
- import Local.*;
- import Local.External.*;
- import Local.External.CMG.*;
- import Local.Game.Level.*;
- import fl.motion.easing.*;
- import flash.display.*;
- import flash.events.*;
- import flash.filters.*;
- import flash.geom.*;
-
- public class CWindow_PostScore extends CWindow
- {
-
- public static const CANCELLED:String = "CANCELLED";
-
- public static const GAMEVERSION:String = "1.0";
-
- {
- if(true)
- {
- CANCELLED = "CANCELLED";
- GAMEVERSION = "1.0";
- }
- }
-
- private var mCancel:Boolean;
-
- public function CWindow_PostScore(param1:DisplayObject)
- {
- if(true)
- {
- super(new Window_PostScore(),param1,new Point(0,0));
- if(true)
- {
- AddButton("cancel",new CScreenButton(mcDisplay.mcCancel,Button_Default)).addEventListener(CScreenButton.MOUSECLICK,e_CANCEL);
- if(true)
- {
- AddButton("ok",new CScreenButton(mcDisplay.mcOK,Button_Default)).addEventListener(CScreenButton.MOUSECLICK,e_OK);
- if(true)
- {
- mcDisplay.tbError.visible = false;
- if(true)
- {
- mcDisplay.tbResult.visible = false;
- if(true)
- {
- mcDisplay.mcOK.visible = false;
- }
- mcDisplay.mcProgress.visible = true;
- }
- mcDisplay.mcCancel.visible = true;
- }
- SetError("Unable to connect the server. Please check your connection and try again!",true);
- }
- SetSuccess("");
- }
- this.addEventListener(OPEN,e_WINDOW_OPENED);
- }
- }
-
- public static function ViewHiscoreTable() : void
- {
- CURL.ViewHiscore(CLevelData.mGameID);
- }
-
- public function e_WINDOW_OPENED(param1:Event = null) : void
- {
- if(true)
- {
- SendScore();
- }
- }
-
- private function SetSuccess(param1:String) : void
- {
- mcDisplay.mcCancel.visible = false;
- mcDisplay.mcProgress.visible = false;
- mcDisplay.tbError.visible = false;
- mcDisplay.tbResult.visible = true;
- mcDisplay.tbResult.text = param1;
- mcDisplay.mcOK.visible = true;
- mCancel = false;
- }
-
- private function e_SCORERESPONSE(param1:ServerResponseEvent) : void
- {
- var _loc2_:* = param1.returnCode;
- if(ScoreSubmitter.RETURNCODE_WORKING === _loc2_)
- {
- §§push(0);
- if(true)
- {
- }
- }
- else if(ScoreSubmitter.RETURNCODE_SUCCESS === _loc2_)
- {
- §§push(1);
- if(false)
- {
- addr84:
- }
- }
- else if(ScoreSubmitter.RETURNCODE_REJECTED === _loc2_)
- {
- §§push(2);
- if(false)
- {
- addr78:
- }
- }
- else if(ScoreSubmitter.RETURNCODE_WRONGVERSION === _loc2_)
- {
- §§goto(addr78);
- §§push(3);
- }
- else if(ScoreSubmitter.RETURNCODE_NETWORKERROR === _loc2_)
- {
- §§goto(addr84);
- §§push(4);
- }
- else
- {
- §§push(5);
- }
- switch(§§pop())
- {
- case 0:
- break;
- case 1:
- SetSuccess("YOUR SCORE HAS BEEN POSTED!!! \nThe score table will open shortly.");
- ViewHiscoreTable();
- break;
- case 2:
- SetError("The server rejected your score for reasons unknown!",false);
- break;
- case 3:
- SetError("Wrong version of the game. Please check for the newest version at CrazyMonkeyGames.com",false);
- break;
- case 4:
- SetError("Your score could not reach the server at this time. There was a network error",true);
- }
- }
-
- public function e_CANCEL(param1:Event = null) : void
- {
- if(true)
- {
- if(mCancel)
- {
- if(true)
- {
- dispatchEvent(new Event(CANCELLED));
- }
- }
- Close();
- }
- }
-
- public function SendScore() : void
- {
- var _loc1_:ScoreSubmitter = null;
- ScoreSubmitter.gameId = CLevelData.mGameID;
- ScoreSubmitter.gameVersion = GAMEVERSION;
- ScoreSubmitter.gameValidationCode = CLevelData.mGameKey;
- _loc1_ = new ScoreSubmitter();
- _loc1_.addEventListener(ScoreSubmitter.SCORE_RESPONSE,e_SCORERESPONSE);
- _loc1_.submitScore(CGlobal.GetField("playerid"),Number(Math.floor(CScreen_Debrief.mScore.mValue)));
- }
-
- private function SetError(param1:String, param2:Boolean) : void
- {
- mcDisplay.mcCancel.visible = false;
- mcDisplay.mcProgress.visible = false;
- mcDisplay.tbResult.visible = false;
- mcDisplay.tbError.visible = true;
- mcDisplay.tbError.text = param1;
- mcDisplay.mcOK.visible = true;
- mCancel = param2;
- }
-
- public function e_OK(param1:Event = null) : void
- {
- CMochiBot.SHZ_BO_HISCOREPOSTED();
- Close();
- }
- }
- }
-